//
//  main.m
//  NSDate
//
//  Created by mir_yan on 2018/10/1.
//  Copyright © 2018年 hakeem. All rights reserved.
//

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
//        NSDate * lastDate = [NSDate distantPast];
//        NSLog(@"%@", lastDate);
//
//        NSDate * nextDate = [NSDate distantFuture];
//        NSLog(@"%@", nextDate);
//
////        NSDate * date = [NSDate date];
//        // 距离现在
////        NSDate * date = [NSDate dateWithTimeIntervalSinceNow:60 * 60 * 24];
//        // 距离设置日期
//        NSDate * date = [NSDate dateWithTimeInterval:60 * 60 * 24 sinceDate:lastDate];
//        NSLog(@"%@", date);
//        --------
//        NSDate* date = [NSDate date];
//        NSDate* date2 = [NSDate dateWithTimeIntervalSinceReferenceDate: 60 * 60 * 24];
//        NSLog(@"%f", date2.timeIntervalSinceNow);
//        NSTimeInterval seconds = [date timeIntervalSinceDate:date2];
        
//        NSLog(@"%f", seconds);
//       ------

        // 格式化日期
//        NSDate * date = [NSDate date];
//        NSDateFormatter * formatter = [[NSDateFormatter alloc] init];
//        formatter.dateStyle = NSDateIntervalFormatterShortStyle;
//        formatter.timeStyle = NSDateIntervalFormatterShortStyle;
//
//        NSString *dateString = [formatter stringFromDate:date];
//        NSLog(@"%@", dateString);
        
        NSDate* date = [NSDate date];
        NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
        formatter.dateFormat = @"yyyy-MM-dd a HH:mm:ss.SSS E Z";
        NSString* dateString = [formatter stringFromDate:date];
        NSLog(@"%@", dateString);
        
    }
    return 0;
}
